function canJump(arr) {
    let max = 0;
    for (let i = 0; i < arr.length; i++) {
        if (max < i) return false // 校验能否到达当前位置
        max = Math.max(max, arr[i] + i)
        if (max >= (arr.length - 1)) return true
    }
    return false
}

console.log(canJump([0, 0, 0, 0, 0, 1]))
console.log(canJump([1, 2, 3]))